import relic_generator
import relic_train_img_generator
import relic_train_y_generator
from relic import Relic

# 生成训练数据
if __name__ == '__main__':
    for i in range(2000):
        relic0 = relic_generator.generate_relic()

        relic_img = relic_train_img_generator.generate_relic_img(relic0)

        text = relic_train_y_generator.generate_relic_box_text(relic0)

        src = "../datasets/relic_images/images/train/"
        relic_img.save(src + str(i) + ".png")
        # relic_img.save("../datasets/relic_images/images/train/" + str(i) + ".png")
        # 你好with open('../datasets/relic_images/labels/train/' + str(i) + ".txt", 'w', encoding="utf-8") as f:
        with open(src.replace("/images/","/labels/") + str(i) + ".txt", 'w', encoding="utf-8") as f:
            for s in text:
                f.write(s + "\n")
        print("第", i, "个已生成")
